package com.tangmu.rabbits.ui.activity.optimization;

import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.tangmu.rabbits.R;
import com.tangmu.rabbits.base.BaseActivity;
import com.tangmu.rabbits.constants.Constants;
import com.tangmu.rabbits.widget.LabelsView;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * 筛选
 */
public class ScreenActivity extends BaseActivity {

    /* @BindView(R.id.screen_recyclerView)
     RecyclerView mRecyclerView;
     private ClassifyScreenAdapter adapter;
     private List<Screen> datas = new ArrayList<>();*/
    @BindView(R.id.screen_labels)
    LabelsView labelsView;
    private List<String> labels = new ArrayList<>();
    //private
    @BindView(R.id.sort_labels)
    LabelsView sortLabelView;
    private List<String> sorts = new ArrayList<>();

    @Override
    protected void initImmersionBar() {
        super.initImmersionBar();
        mImmersionBar.statusBarColor(R.color.transparent).titleBar(R.id.headerView).init();
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_screen;
    }

    @Override
    protected void initPresenter() {

    }

    @Override
    protected void initView() {
        setHeaderImage(Constants.Position.LEFT, R.drawable.icon_back, false, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        setHeaderTitle("筛选宝贝");

        initDatas();
       /* datas = DataFactory.screens();

        mRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(4, OrientationHelper.VERTICAL));
        adapter = new ClassifyScreenAdapter(mContext, datas);
        mRecyclerView.setAdapter(adapter);*/
        labelsView.setLabels(labels, new LabelsView.LabelTextProvider<String>() {
            @Override
            public CharSequence getLabelText(TextView label, int position, String data) {
                return data;
            }
        });
        sortLabelView.setLabels(sorts, new LabelsView.LabelTextProvider<String>() {
            @Override
            public CharSequence getLabelText(TextView label, int position, String data) {
                return data;
            }
        });

        labelsView.setOnLabelClickListener(new LabelsView.OnLabelClickListener() {
            @Override
            public void onLabelClick(TextView label, Object data, int position) {
                Toast.makeText(ScreenActivity.this, position + " : " + data,
                        Toast.LENGTH_SHORT).show();
            }
        });


    }

    private void initDatas() {
        labels.add("全部");
        labels.add("女装");
        labels.add("男装");
        labels.add("内衣");
        labels.add("美妆");
        labels.add("家居");
        labels.add("母婴");
        labels.add("视频");
        labels.add("鞋包配饰");
        labels.add("数码电器");
        labels.add("文体户外");

        sorts.add("全部");
        sorts.add("销量");
        sorts.add("最新");
        sorts.add("到手价从高到低");
        sorts.add("到手价从低到高");
    }
}
